package com.our123.cms.action.directive.abs;

import java.util.Map;

import com.our123.common.web.freemarker.DirectiveUtils;

import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;

public abstract class AbstractCmsUserDirective implements TemplateDirectiveModel {
	/**
	 * 输入参数，群组ID。
	 */
	public static final String PARAM_GROUP_ID = "groupId";
	/**
	 * 输入参数，等级。
	 */
	public static final String PARAM_RANK = "rank";
	/**
	 * 输入参数，排列顺序。0:按作品量排序;1:按最新登陆时间排序;2:按最新注册时间排序;3:按最近发布时间排序;4:按登陆次数排序
	 */
	public static final String PARAM_ORDER_BY = "orderBy";

	protected Integer getGroupId(Map<String, TemplateModel> params) throws TemplateException {
		return DirectiveUtils.getInt(PARAM_GROUP_ID, params);
	}

	protected Integer getRank(Map<String, TemplateModel> params) throws TemplateException {
		return DirectiveUtils.getInt(PARAM_RANK, params);
	}

	protected Integer getOrderBy(Map<String, TemplateModel> params) throws TemplateException {
		return DirectiveUtils.getInt(PARAM_ORDER_BY, params);
	}
}
